<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="VB" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<mobile:Form runat="server" id="first">
   Enter name:
   <mobile:TextBox runat="server" id="name"/>
   Enter password:
   <mobile:TextBox runat="server" id="password" Password="true"/>
   Confirm password:
   <mobile:TextBox runat="server" id="confirm" Password="true"/>
   <mobile:Command runat="server" id="enter" Onclick="enter_click"
                   Text="Enter"/>
   <mobile:RequiredFieldValidator runat="server" ControlToValidate="name"
                                  ErrorMessage="Please enter a name" />
   <mobile:RequiredFieldValidator runat="server"
                                  ControlToValidate="password"
                                  ErrorMessage="Please enter a password" />
   <mobile:RequiredFieldValidator runat="server" ControlToValidate="confirm"
                              ErrorMessage="Please confirm your password" />
   <mobile:CompareValidator runat="server" ControlToValidate="confirm"
                            ControlToCompare="password"
                          ErrorMessage="Confirmation must match password" />
</mobile:Form>

<mobile:Form runat="server" id="second">
   <mobile:ValidationSummary runat="server" formToValidate="first"
                             HeaderText="Invalid input"/>
</mobile:Form>

<mobile:Form runat="server" id="third">
   <mobile:Label runat="server">Input accepted.</mobile:Label>
</mobile:Form>

<script runat="server">

public sub enter_click(sender As Object, e As System.EventArgs)
   if (Page.IsValid) then
      ActiveForm = third
   else
      ActiveForm = second
   end if
end sub

</script>
